﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MDT.LifeSewagePlatform.Conmmon
{
    public class DataMessage<T>:BaseMessage
    {
        public DataMessage(string msg,int code,bool status,PageList<T> Data)
            :base(msg,code,status)
        {
            data = Data;
            total = Data.TotalCount;
            totalPage = Data.TotalPages;
            currentPage = data.CurrentPage;
            pageSize = data.PageSize;
        }
        public PageList<T> data { get; set; }
        public int total { get; set; }
        public int pageSize { get; set; }
        public int totalPage { get; set; }
        public int currentPage { get; set; }
    }

    public class DataMessage : BaseMessage
    {
        public DataMessage(string msg, int code, bool status,object Data)
            : base(msg, code, status)
        {
            data = Data;
        }
        public object data { get; set; }
        public T GetData<T>() where T : class
        {
            if (data != null)
            {
                if (data is T)
                {
                    return (T)data;
                }
            }
            return null;
        }
    }
}
